#include <stdlib.h>
#include "includes/mystack.h"

mystack *mystack_create(int c) {
    mystack *s = malloc(sizeof(mystack));
    s->top = 0;
    s->capacity = c;
    void **d = malloc(sizeof(void *) * c);
    s->data = d;
    return s;
}

int mystack_push(mystack *s, void *data) {
    if(MYSTACK_IS_FULL(s)) return 0;
    s->data[s->top++] = data;
    return 1;
}

void *mystack_pop(mystack *s) {
    if(MYSTACK_IS_EMPTY(s)) return NULL;
    return s->data[--s->top];
}
